package com.hospital.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hospital.server.ExcelServer;
@WebServlet("/manage/ExcelServlet")
public class ExcelServlet extends HttpServlet {

	public ExcelServlet() {
		super();
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setContentType("text/xml");
		PrintWriter out = response.getWriter();
		String type=request.getParameter("type");
		String filename =request.getParameter("filename");
		if(type.equals("excToMqsql")){
			ExcelToMySql(request,response,filename);
		}
		request.getRequestDispatcher("/manage/user_info_manage.jsp").forward(request, response);
	}
	private void ExcelToMySql(HttpServletRequest request,HttpServletResponse response,String filename) {
		ExcelServer es=new ExcelServer();
		es.getDate(filename);
	}
}